﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Dal
{
    public class AdminDAL
    {
        public int adminlogin(string admin, string pwd)
        {
            string sql = "select * from admin where admin='" + admin + "' and adminpwd='"+pwd+"'";
            DataTable dt = DbSqlHelper.Query(sql).Tables[0];
            if (dt.Rows.Count > 0)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
        public string getAdminPwd()
        {
            string sql = "select adminpwd from admin where admin='admin'";
            DataTable dt = DbSqlHelper.Query(sql).Tables[0];
            return dt.Rows.Count>0?dt.Rows[0][0].ToString():"";
        }
        public int PwdUpdate(string pwd)
        {
            string sql = "update admin set adminpwd='"+pwd+"' where admin='admin'";
            return DbSqlHelper.ExecuteSql(sql);
        }
    }
}
